<template>
  <van-row class="notes_videos" type="flex" justify="space-between">
    <van-col span="5">
      <span>{{ title || '视频备注'}}</span>
    </van-col>
    <van-col span="19" class="content_pic">
      <div v-if="videoStr">
        <van-uploader
          v-model="videoStr && videoStr.split('|').map(urlPath => ({url: urlPath}))"
          :deletable="false"
          :show-upload="false"
          @click-preview="previewVideos"
        >
          <template #preview-cover>
            <van-image
              width="80"
              height="80"
              :src="videoIcon"
            />
          </template>
        </van-uploader>
      </div>
      <span v-else>无</span>
    </van-col>
  </van-row>

</template>

<script>
import videoIcon from '../assets/videoIcon.png';
export default {
  name: "comVideoList",
  props: ['title', 'videoStr'],
  data(){
    return {
      videoIcon,
    }
  },

  methods: {
    previewVideos(file, detail){
      // console.warn(file.url, detail.index);
      // 跨组件通信，使用bus总线。
      this.$bus.$emit('toPreviewAndPlayVideo', file.url);
    },
  }
}
</script>

<style lang="scss" scoped>
.notes_videos{
  padding: 0.26667rem 0.42667rem;
  font-size: 0.37333rem;
  color: #323233;
  line-height: 0.64rem;
  background-color: #FFFFFF;
  box-sizing: border-box;
  .content_pic{
    text-align: right;
    color: #969799;
    /deep/ .van-ellipsis{
      display: none;
    }
  }
}
</style>
